package org.springframework.prospring.ticket.web;

import org.springframework.webflow.action.FormAction;
import org.springframework.webflow.RequestContext;
import org.springframework.webflow.Event;
import org.springframework.prospring.ticket.service.ReservationFieldRequest;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Adm
 * Date: 23/07/2006
 * Time: 19:58:47
 * To change this template use File | Settings | File Templates.
 */
public class ReservationFieldFormAction extends FormAction {

    public ReservationFieldFormAction() {
        setFormObjectClass(ReservationFieldRequest.class);

        if (logger.isDebugEnabled()){
            logger.debug("in ReservationFieldFormAction constructor...");
        }
    }

/*
    public static class FormObject implements Serializable {
        private String data;


        public String getData() {
            return data;
        }

        public void setData(String data) {
            this.data = data;
        }
    }
*/

    /**
     * A "submit" hook: an action execute method, called after
     * binding and validation.
     */
    public Event processSubmit(RequestContext context) throws Exception {
        ReservationFieldRequest reservationFieldRequest = (ReservationFieldRequest)getFormObject(context);

        if (reservationFieldRequest != null){
            System.out.println("reservationFieldRequest = " + reservationFieldRequest);            
        }


        // do submit logic
        return success();
    }

    public ReservationFieldRequest findRegions(RequestContext context) throws Exception {

        ReservationFieldRequest reservationFieldRequest = (ReservationFieldRequest)getFormObject(context);

        if (reservationFieldRequest != null){
            System.out.println("reservationFieldRequest = " + reservationFieldRequest);
        }

        return reservationFieldRequest;
    }



}
